<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<title>添加游戏-租号狗后台管理系统</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<link rel="stylesheet" href="../../../5d824063e09a9/static/css/font.css">
	<link rel="stylesheet" href="../../../5d824063e09a9/static/css/weadmin.css">
	<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
	<!--[if lt IE 9]>
	<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
	<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
	<![endif]-->
</head>

<body>
<div class="weadmin-body">
	<form class="layui-form">
		<div class="layui-form-item">
			<label for="L_gametype" class="layui-form-label">
				<span class="we-red">*</span>游戏类型
			</label>
			<div class="layui-input-inline">
				<input type="text" id="L_gametype" name="gametype" lay-verify="required|gametype" autocomplete="off" class="layui-input">
			</div>
		</div>

		<div class="layui-form-item">
			<label for="L_gamename" class="layui-form-label">
				<span class="we-red">*</span>游戏名称
			</label>
			<div class="layui-input-inline">
				<input type="text" id="L_gamename" name="gamename" lay-verify="required|gamename" autocomplete="off" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label for="L_gameregion" class="layui-form-label">
				<span class="we-red">*</span>游戏区服
			</label>
			<div class="layui-input-inline">
				<input type="text" id="L_gameregion" name="gameregion" lay-verify="required|gameregion" autocomplete="off" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label for="L_gameregion" class="layui-form-label">
			</label>
			<button class="layui-btn" lay-filter="add" lay-submit="">确定</button>
		</div>
	</form>
</div>
<script src="../../../5d824063e09a9/lib/layui/layui.js" charset="utf-8"></script>

<script>
	layui.extend({
		admin: '{/}../../static/js/admin'
	});
	layui.use(['form', 'jquery','util','admin', 'layer'], function() {
		var form = layui.form,
				$ = layui.jquery,
				util = layui.util,
				admin = layui.admin,
				layer = layui.layer;


		//监听提交
		form.on('submit(add)', function(data) {
			//console.log(data.field);
			var f = data.field;
			//console.log(f.username);
			//console.log(f.sex);
			//var sex = $('input:radio[name="sex"]:checked').val();

			//发异步，把数据提交给php
			layer.alert("添加成功", {
				icon: 6
			}, function () {
				//获取提交成功的时间
				var time = new Date();
				var timeNow = util.toDateString(time);
				// 获得frame索引
				var index = parent.layer.getFrameIndex(window.name);

				var _len = parent.$('#memberList tr').length;
				alert(_len);
				parent.$('#memberList').append(
						'<tr data-id="' + _len + '">' +
						'<td>' +
						'<div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id="' + _len + '"><i class="layui-icon">&#xe605;</i></div>' +
						'</td>' +
						'<td>' + _len + '</td>' +
						'<td>' + f.gametype + '</td>' +
						'<td>' + f.gamename + '</td>' +
						'<td>' + f.gameregion + '</td>' +
						'<td class="td-manage">' +
						'<a title="编辑" onclick="WeAdminShow(\'编辑\',\'./编辑.html\',600,400)" href="javascript:;"><i class="layui-icon">&#xe642;</i></a>' +
						'<a title="删除" onclick="member_del(this,\'要删除的id\')" href="javascript:;"><i class="layui-icon">&#xe640;</i></a>' +
						'</td>' +
						'</tr>'
				);
				//关闭当前frame
				parent.layer.close(index);
			});
		})
	})
</script>
</body>

</html>